//
//  FirstViewController.m
//  UI07_property_delegate_block
//
//  Created by Hanlingyu on 16/7/22.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "FirstViewController.h"
#import "SecondViewController.h"

#warning 签代理
@interface FirstViewController () <SecondVCPassValue>

@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor cyanColor];
    
    
    // 关于BaseViewController
    // 是基类的ViewController
    // 在这个Controller中, 进行统一的修改
    // 例如: 统一修改坐标系, 统一修改背景色
    // 统一修改navgationBar的barTintColor, TintColor等
    
    
    
    
    // 注意坐标系问题
    self.navigationController.navigationBar.translucent = NO;
    //
    self.edgesForExtendedLayout = UIRectEdgeNone;
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 50)];
    self.titleLabel.backgroundColor = [UIColor whiteColor];
    self.titleLabel.text = @"Fuck";
    [self.view addSubview:self.titleLabel];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor blueColor];
    button.frame = CGRectMake(100, 200, 50, 30);
    [button setTitle:@"下一页" forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(pushSecondPage:) forControlEvents:UIControlEventTouchUpInside];
    
}


- (void)viewWillAppear:(BOOL)animated {

    [super viewDidAppear:animated];
    NSLog(@"%@", self.titleTextFiled);
}

- (void)pushSecondPage:(UIButton *)button {
    
    SecondViewController *second = [[SecondViewController alloc] init];
    second.first = self;
//#warning 指定代理人
//    _second.delegate = self;
//    _second.titleString = self.titleLabel.text;
    [self.navigationController pushViewController:second animated:YES];
    
    
}
#warning 实现协议方法
- (void)passValue:(NSString *)string {
    NSLog(@"%@", string);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
